/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package utils;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.logging.Level;
import java.util.logging.Logger;
import render.CTCTableModel;

/**
 *
 * @author Canh
 */
public class Reflection {

    public static Object readMethodValue(Object obj, String name) {
        try {

            Method getValue = obj.getClass().getDeclaredMethod(name, new Class[]{});
            return getValue.invoke(obj);

        } catch (NoSuchMethodException ex) {
            Logger.getLogger(CTCTableModel.class.getName()).log(Level.SEVERE, null, ex);
        } catch (SecurityException ex) {
            Logger.getLogger(CTCTableModel.class.getName()).log(Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            Logger.getLogger(CTCTableModel.class.getName()).log(Level.SEVERE, null, ex);
        } catch (IllegalArgumentException ex) {
            Logger.getLogger(CTCTableModel.class.getName()).log(Level.SEVERE, null, ex);
        } catch (InvocationTargetException ex) {
            Logger.getLogger(CTCTableModel.class.getName()).log(Level.SEVERE, null, ex);
        }
        return "";
    }
}
